/*
 * Copyright (c) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import router from '@system.router';
import featureAbility from '@ohos.ability.featureAbility';
import display from '@ohos.display';

const serviceData = [
    {
        'title': '服务',
        'imgUrl': '/common/images/personPic/1.png',
    },
];
const functionData = [
    {
        'title': '收藏',
        'imgUrl': '/common/images/personPic/2.png',
    },
    {
        'title': '相册',
        'imgUrl': '/common/images/personPic/3.png',
    },
    {
        'title': '状态',
        'imgUrl': '/common/images/personPic/4.png',
    },
];
const settingData = [
    {
        'title': '设置',
        'imgUrl': '/common/images/personPic/5.png',
    },
];
const personData = {
    'name': '我叫学习',
    'personNum': '萌聊号:',
    'imgUrl': '/common/images/sessionPic/img_7.png',
}

export default {
    data: {
        functionList: functionData,
        setting: settingData,
        service: serviceData,
        person:personData,
        uid:'',
    },
    onInit() {
//        this.title = this.$t('strings.world');
        console.log('宽度:' + display.width + "高度：" + display.height);
        this.grantPermission()
    },
    onCreate(){
      this.uid = this.$app.$def.uid
    },
    /*获取部分权限*/
    grantPermission() {
        console.info('grantPermission')
        let context = featureAbility.getContext()
        context.requestPermissionsFromUser(['ohos.permission.DISTRIBUTED_DATASYNC'], 666, function (result) {
            console.info(`grantPermission,requestPermissionsFromUser`)
        })
    },
    // 点击事件
    itemClick(chat){
        router.push({
            uri: "pages/dialogPage/dialogPage",
            params: {
                'title': personData.name,
                'type': personData.personNum,
                'imgUrl': personData.imgUrl,
            }
        });
    },
    chat(){
        router.push({
            uri: "pages/sessionList/sessionList",
        });
    },
    message(){
        router.push({
            uri: "pages/mailList/mailList",
        });
    },
    find(){
        router.push({
            uri: "pages/findList/findList",
        });
    },
    switch(){
        router.push({
            uri: "pages/myList/personPage/personPage",
            params: {
                'title': personData.name,
                'type': personData.personNum,
                'imgUrl': personData.imgUrl,
            }
        });
}


}



